package com.xyoto.community.utils;

import io.swagger.annotations.ApiModel;

/**
 * @author coderFu
 * @create 2021/10/2
 */
@ApiModel("性别转换工具")
public class SexTransformUtil {

    private static final String MAN = "男";
    private static final String WOMEN = "女";
    private static final String UNKNOWN = "未知";

    public static short transformSex(String sex){
        short result = 0;
        if (MAN.equals(sex)){
            result = 1;
        }else if (WOMEN.equals(sex)){
            result = 2;
        }
        return result;
    }

    public static String transformSexStr(Short sex){
        String result = "";
        if (sex == 0){
            result =  UNKNOWN;
        }else if (sex == 1){
            result = MAN;
        }else if (sex == 2){
            result = WOMEN;
        }
        return result;
    }
}
